<?php # mysql_connect.php 
		define('DB_USER','root');
		define('DB_PASSWORD','root');
		define('DB_HOST','localhost');
		define('DB_NAME','db_library');
		
		$dbc = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD)OR die('could  not connect to mysql:'.mysql_error());
		mysql_select_db(DB_NAME)OR die('could not select the database'.mysql_error());
        mysql_query("set names utf8");
		
function escape_data ($data) {
	
	// Address Magic Quotes.
	if (ini_get('magic_quotes_gpc')) {
		$data = stripslashes($data);
	}
	
	// Check for mysql_real_escape_string() support.
	if (function_exists('mysql_real_escape_string')) {
		global $dbc; // Need the connection.
		$data = mysql_real_escape_string (trim($data), $dbc);
	} else {
		$data = mysql_escape_string (trim($data));
	}

	// Return the escaped value.	
	return $data;

} // End of function.
?>
		